.POSIX:
PREFIX=		/usr/local
MANDIR=		man

SRC=	./ffstripe.c

default: ffstripe
all: default README
ffstripe: ${SRC} Makefile
	${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${SRC}
install: ffstripe
	install -m 444 ffstripe.1 ${DESTDIR}${PREFIX}/${MANDIR}/man1/
	install -m 755 ffstripe ${DESTDIR}${PREFIX}/bin/
install-local: ffstripe
	install -m 755 ffstripe ${HOME}/bin/
README: ffstripe.1 Makefile
	mandoc -Ios= -Tutf8 ffstripe.1 |\
	    awk '{gsub(/.\b/,"");a=b;b=c;c=$$0}FNR>4{print a}' > $@
clean:
	rm -f ffstripe *.png
clean-all: clean
	rm -f README

flags: nation pride

# Colors from Wikipedia
nation:	armenia.png austria.png belgium.png bolivia.png		\
	botswana.png bulgaria.png chad.png columbia.png		\
	costa-rica.png crimea.png estonia.png french.png	\
	gabon.png germany.png guinea.png hungary.png		\
	indonesia.png ireland.png italy.png ivory-coast.png	\
	latvia.png lithuania.png luxembourg.png mali.png	\
	mauritius.png monaco.png netherlands.png nigeria.png	\
	northumbria.png peru.png poland.png romania.png		\
	russia.png sierra-leone.png thailand.png the-gambia.png	\
	ukraine.png yemen.png europe-barcode.png
armenia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} D90012 0033A0 F2A800 | ff2png > $@
austria.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} ED2939 FFFFFF ED2939 | ff2png > $@
belgium.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 000000 FDDA24 EF3340 | \
	    ff2png > $@
bolivia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} D52B1E F9E300 007934 | ff2png > $@
botswana.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 75AADB:9 FFFFFF 000000:4 FFFFFF \
	    75AADB:9 | ff2png > $@
bulgaria.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFFFF 00966E D62612 | ff2png > $@
chad.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 002664 FECB00 C60C30 | \
	    ff2png > $@
columbia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FCD116:2 003893 CE1126 | \
	    ff2png > $@
costa-rica.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 002B7F FFFFFF CE1126 CE1126 \
	    FFFFFF 002B7F | ff2png > $@
crimea.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 006FB0 FFFFFF:4 DA251D | \
	    ff2png > $@
estonia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 0072CE 000000 FFFFFF | ff2png > $@
french.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 0050A4 FFFFFF EF4135 | \
	    ff2png > $@
gabon.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 009E60 FCD116 3A75C4 | ff2png > $@
germany.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 DD0000 FFCE00 | ff2png > $@
guinea.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} CF0821 FCD20E 009560 | \
	    ff2png > $@
hungary.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} CD2A3E FFFFFF 436F4D | ff2png > $@
indonesia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF0000 FFFFFF | ff2png > $@
ireland.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 169B62 FFFFFF FF883E | \
	    ff2png > $@
italy.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 008C45 F4F5F0 CD212A | \
	    ff2png > $@
ivory-coast.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} F77F00 FFFFFF 009E60 | \
	    ff2png > $@
latvia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 9E3039:2 FFFFFF 9E3039:2 | \
	    ff2png > $@
lithuania.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FDB913 006A44 C1272D | ff2png > $@
luxembourg.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} ED2939 FFFFFF 00A1DE | ff2png > $@
mali.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 0CB637 FCD20E CF0821 | \
	    ff2png > $@
mauritius.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} EA2839 1A206D FFD500 00A551 | \
	    ff2png > $@
monaco.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} CE1126 FFFFFF | ff2png > $@
netherlands.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} AE1C28 FFFFFF 21468B | ff2png > $@
nigeria.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 008753 FFFFFF 008753 | \
	    ff2png > $@
northumbria.png: ffstripe Makefile
	./ffstripe -v${FFSTRIPE_FLAGS} FFCF00 A01431 FFCF00 A01431 \
	FFCF00 A01431 FFCF00 A01431 | ff2png > $@
peru.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} D91023 FFFFFF D91023 | \
	    ff2png > $@
poland.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} E9E8E7 D4213D | ff2png > $@
romania.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 002B7F FCD116 CE1126 | \
	    ff2png > $@
russia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFFFF:3 0039A6:2 D52B1E:3 | \
	    ff2png > $@
sierra-leone.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 1EB53A FFFFFF 0072C6 | ff2png > $@
thailand.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} ED1C24 FFFFFF 241D4F:2 FFFFFF \
	    ED1C24 | ff2png > $@
the-gambia.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} CF0821:6 FFFFFF 04168D:4 FFFFFF \
	    377823:6 | ff2png > $@
ukraine.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 005BBB FFD500 | ff2png > $@
yemen.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} CE1126 FFFFFF 000000 | ff2png > $@
europe-barcode.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 257E00:4 FFFFFF:4	\
	    FF6A00:4 21007F:4 FFFFFF FE0004:2 FFFFFF 21007F:4	\
	    257E00:4 FE0004:8 FED805:4 FF0004:4 21007F:4	\
	    FFFFFF:4 FF0004:4 000000:4 FFD800:4 FF0004:8	\
	    FFFFFF:4 004A7F:4 FF0004:4 FFFFFF:4 004A7F:4	\
	    000000:4 FF0004:4 FED005:4 257E00:4 FFFFFF:4	\
	    FF0004:8 FFFFFF:4 FF0004:8 FFFFFF:4 FF0004:4	\
	    004A7F:5 FED005:2 004A7F:5 FFFFFF:5 21007F:2	\
	    FFFFFF:5 004A7F:2 FFFFFF:2 004A7F:2 FFFFFF:2	\
	    004A7F:2 FFFFFF:2 004A7F:2 | ff2png > $@

# Colors from Wikipedia
pride:	rainbow.png rainbow-7.png rainbow-8.png aromantic.png \
	sexuality gender
rainbow.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} E40303 FF8C00 FFED00 008026 \
	    004DFF 750787 | ff2png > $@
rainbow-7.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF0000 FF8E00 FFFF00 008E00 \
	    00C0C0 400098 8E008E | ff2png > $@
rainbow-8.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF69B4 FF0000 FF8E00 FFFF00 \
	    008E00 00C0C0 400098 8E008E | ff2png > $@
aromantic.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 3AA740 A8D47A FFFFFF ABABAB \
	    000000 | ff2png > $@

# Colors from Wikipedia
sexuality: asexual.png bisexual.png pansexual.png
asexual.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 A3A3A3 FFFFFF 800080 | \
	    ff2png > $@
bisexual.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} D60270:2 9B4F96 0038A8:2 | \
	    ff2png > $@
pansexual.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF218C FFD800 21B1FF | ff2png > $@
polysexual.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} F61CB9 07D569 1C92F6 | ff2png > $@

# Colors from the Gender Wiki
gender:	agender.png agender-alt.png agenderboy.png 		\
	agendergirl.png ambonec.png ambonec-alt.png 		\
	androgyne.png apogender.png aporagender.png 		\
	bigender.png bigenderflux.png boyflux.png 		\
	cobblogender.png demiflux.png demigal.png demiguy.png 	\
	egogender.png fluidflux.png gendercreative.png 		\
	genderfae.png genderfaun.png genderfluid.png 		\
	genderflux.png genderqueer.png girlflux.png 		\
	greygender.png intergender.png intersex.png 		\
	librafeminine.png libramasculine.png magiboy.png 	\
	magienby.png magifluid.png magigirl.png maverique.png 	\
	multiflux.png neutrois.png neutroisflux.png 		\
	nonbinary.png nonbinary-alt.png nonbinaryflux.png 	\
	pangender.png pangender-alt.png paraboy.png 		\
	paragender.png paragirl.png periboy.png perigender.png 	\
	perigirl.png polygender.png trans.png trigender.png 	\
	triquiboy.png 
agender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 B9B9B9 FFFFFF B8F483 \
	    FFFFFF B9B9B9 000000 | ff2png > $@
agender-alt.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 7F7F7F FFFFFF AC6CCE \
	    66D006 AC6CCE FFFFFF 7F7F7F 000000 | ff2png > $@
agenderboy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 A0CCF9 FFFFFF B6F583 \
	    FFFFFF A0CCF9 000000 | ff2png > $@
agendergirl.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 E7B4D3 FFFFFF B6F583 \
	    FFFFFF E7B4D3 000000 | ff2png > $@
ambonec.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} 7092BE:9 C3C3C3 7092BE:9 | \
	    ff2png > $@
ambonec-alt.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} FCAADB FBA5EE EEA3F6 D79FF6 \
	    C09EF5 A89AF2 979DF1 93B0EC 90C1EA 8FD8EB | ff2png > $@
androgyne.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} FE007F 9832FF 00B8E7 | \
	    ff2png > $@
apogender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 447D4B A9F57A 000000 A9F57A \
	    447D4B | ff2png > $@
aporagender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} F37CCA E1BDF0 FFF982 E1BDF0 \
	    7BBBDD | ff2png > $@
bigender.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} C57AA1 EDA8CC D6C8E9 FFFFFF \
	    D6C8E9 EDA8CC C57AA1 | ff2png > $@
bigenderflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} ED78AA F5B67C FDF44D FEF9A6 \
	    FFFFFF D7B6DF AE6DBE 8F86D1 719EE3 | ff2png > $@
boyflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} D6E9F8 6FABF4 02366F 9EEDAB \
	    02366F 6FABF4 D6E9F8 | ff2png > $@
cobblogender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFF01 7030A0 00FF01 | ff2png > $@
demiflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} DADADA C3C3C3 FFB5B7 F3F691 \
	    99D9EA C3C3C3 DADADA | ff2png > $@
demigal.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7F7F7F C3C3C3 FFAEC9 FFFFFF \
	    FFAEC9 C3C3C3 7F7F7F | ff2png > $@
demiguy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7F7F7F C3C3C3 99D9EA FFFFFF \
	    99D9EA C3C3C3 7F7F7F | ff2png > $@
egogender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 F8FF71 FFFFFF FBDE3C | \
	    ff2png > $@
fluidflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF115F A349A3 00A3E8 FFDF00 \
	    000000 FFED71 85DAFF DBADDB FF8DB1 | ff2png > $@
gendercreative.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7E1AB0:2 FFFFFF 7E1AB0:2 | \
	    ff2png > $@
genderfae.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 96C3A4 C2DEAE F9FACE FFFFFF \
	    FCA2C5 DA8AE3 AA7EDD | ff2png > $@
genderfaun.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FCC688 FFF09B FAF9CD FFFFFF \
	    8EDFD9 8CACDD 9782EB | ff2png > $@
genderfluid.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF75A2 FFFFFF BE18D6 000000 \
	    333EBD | ff2png > $@
genderflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} F47694 F2A2B9 CECECE 7CE0F7 \
	    3ECDF9 FFF48D | ff2png > $@
genderqueer.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} B57EDC FFFFFF 4A8123 | ff2png > $@
girlflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} F9E6D7 F2526C BF0311 E9C587 \
	    BF0311 F2526C F9E6D7 | ff2png > $@
greygender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} BFBEBE:4 FFFFFF 072384:4 FFFFFF \
	    515151:4 | ff2png > $@
intergender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FF66AE 7F7F7F FFDE22 7F7F7F \
	FFDE22 7F7F7F 37B9FF | ff2png > $@
intersex.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} D7ABCF FFFFFF A0CEEF F0B8D5 \
	    FFFFFF D7ABCF | ff2png > $@
librafeminine.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 A3A3A3 FFFFFF C6568F \
	    FFFFFF A3A3A3 000000 | ff2png > $@
libramasculine.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 A3A3A3 FFFFFF 56C5C5 \
	    FFFFFF A3A3A3 000000 | ff2png > $@
magiboy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7F7F7F C3C3C3 FFFFFF 5CC5DE:2 \
	    99D9EA:4 5CC5DE:2 FFFFFF C3C3C3 7F7F7F | ff2png > $@
magienby.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7F7F7F C3C3C3 FFFFFF FEF55C:2 \
	    FEF3AB:4 FEF55C:2 FFFFFF C3C3C3 7F7F7F | ff2png > $@
magifluid.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 C45393 272672 1E5C5B \
	    FFFFFF 1E5C5B 272672 C45393 000000 | ff2png > $@
magigirl.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 7F7F7F C3C3C3 FFFFFF FF80C0:2 \
	    FFAEC9:4 FF80C0:2 FFFFFF C3C3C3 7F7F7F | ff2png > $@
maverique.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFF433 FFFFFF F49622 | ff2png > $@
multiflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFF48E FEAEC9 FFFFFF 040000 \
	    C3C3C3 FFFFFF 3ECDF9 FFF48E | ff2png > $@
neutrois.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFFFF 22B14C 000000 | \
	    ff2png > $@
neutroisflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFFFF:6 F47695 F1A3B9 CECECE \
	    7BE0F7 3ECDFA 21B14C 000000:6 | ff2png > $@
nonbinary.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFF430 FFFFFF 9C59D1 292929 | \
	    ff2png > $@
nonbinary-alt.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 FFFFFF A547A6 FFF200 \
	    A547A6 FFFFFF 000000 | ff2png > $@
nonbinaryflux.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFF759 11B8FF FFFFFF FFAEC9 \
	    B85FB8 000000 | ff2png > $@
pangender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFF798 FFDDCD FFEBFB FFFFFF \
	    FFEBFB FFDDCD FFF798 | ff2png > $@
pangender-alt.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} FFFFFF FFEBFB FFDDCD FFF798 \
	    FFDDCD FFEBFB FFFFFF | ff2png > $@
paraboy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 9C9C9C:15 FFFFFF:9 E7CEEE:9 \
	    C78AD7:6 0908C5:2 C78AD7:6 E7CEEE:9 FFFFFF:9 9C9C9C:15 | \
	    ff2png > $@
paragender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 9C9C9C:15 FFFFFF:9 BDE4D7:9 \
	    63BFA1:6 F3EE94:2 63BFA1:6 BDE4D7:9 FFFFFF:9 9C9C9C:15 | \
	    ff2png > $@
paragirl.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 9C9C9C:15 FFFFFF:9 FCCDBB:9 \
	    FF8765:6 FF2650:2 FF8765:6 FCCDBB:9 FFFFFF:9 9C9C9C:15 | \
	    ff2png > $@
periboy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 555555 91BAEE CDCDCD F4F192 \
	    959595 | ff2png > $@
perigender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 555555 F4F192 CDCDCD F4F192 \
	    959595 | ff2png > $@
perigirl.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 555555 DD75D4 CDCDCD F4F192 \
	    959595 | ff2png > $@
polygender.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 000000 949494 EE95C6 F5EE82 \
	    64BCE7 | ff2png > $@
trans.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 5BCEFA F5A9B8 FFFFFF F5A9B8 \
	    5BCEFA | ff2png > $@
trigender.png: ffstripe Makefile
	./ffstripe -v ${FFSTRIPE_FLAGS} FF96C6 9682FF 67DA66 9682FF \
	    FF96C6 | ff2png > $@
triquiboy.png: ffstripe Makefile
	./ffstripe ${FFSTRIPE_FLAGS} 6E6E6E:3 62CCDD FFFFFF:2 62CCDD \
	    6E6E6E:6 62CCDD FFFFFF:2 62CCDD 6E6E6E:3 | ff2png > $@
